package App.Controller;

import App.Model.BaseData.CrmLanguage;
import App.Model.DataResponse;
import App.Service.BaseDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/basedata/")
public class BaseDataController extends BaseController{
    @Autowired
    private BaseDataService _service;

    @RequestMapping("language")
    public ResponseEntity<?> getLanguage() {
        DataResponse _dataResponse = new DataResponse();
        try {
            List<CrmLanguage> _result = _service.getLanguage();
            _dataResponse.setData(_result);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return new ResponseEntity(_dataResponse, HttpStatus.OK);
    }
}
